package com.flymobi.admin;

import java.util.List;

import com.flymobi.fw.modules.SM;
import com.flymobi.po.FriendsLink;
import com.flymobi.po.Manager;
import com.flymobi.util.C;
import com.flymobi.util.Pagination;
import com.flymobi.util.WebContext;

/**
 * 
 * 
 * Title:
 * 
 * Description:
 * 
 * Copyright: Copyright (c) 2008
 * 
 * @author haoxz11
 * @created Oct 21, 2008 11:16:42 AM
 * @version $Id: ManagerAction.java,v 1.1 2010/04/09 03:27:08 airsou Exp $
 */
public class FriendsLinkAction extends WebAction {
	/*
	 * private String method; private String id;
	 */
	private FriendsLink friendsLink;

	/**
	 * @return the friendsLink
	 */
	public FriendsLink getFriendsLink() {
		return friendsLink;
	}

	/**
	 * @param friendsLink
	 *            the friendsLink to set
	 */
	public void setFriendsLink(FriendsLink friendsLink) {
		this.friendsLink = friendsLink;
	}

	/**
	 * Comment for <code>serialVersionUID</code>
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public String webProcess(WebContext context, Manager manager) {
		if ("add".equals(method)) {
			return "edit";
		} else if ("edit".equals(method)) {
			FriendsLink friendsLink = SM.FriendsLinkService.get(id);
			context.put("friendsLink", friendsLink);
			return "edit";
		} else if ("delete".equals(method)) {
			SM.FriendsLinkService.delete(id);
			context.put("rmsg", C.TEXT.DELETE_SUCCESS);
			method = "list";
			return this.webProcess(context, manager);
		} else if ("save".equals(method)) {
			SM.FriendsLinkService.save(friendsLink);
			context.put("rmsg", C.TEXT.SAVE_SUCCESS);
			method = "list";
			return this.webProcess(context, manager);
		} else if ("list".equals(method)) {
			List<FriendsLink> friendsLinkList = SM.FriendsLinkService.list(
					startRow, pagePerSize);
			context.put("friendsLinkList", friendsLinkList);
			context.put("pagenation", new Pagination(SM.FriendsLinkService
					.getCount().intValue(), startRow, pagePerSize));
			return "list";
		} else {
			method = "list";
			return this.webProcess(context, manager);
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.camel.admin.WebAction#getSysLog()
	 */
	@Override
	public String getSysLog() {
		String opr = "";

		return opr;
	}
}
